<?php
$uri_segment = $this->uri->segment(3);
if($uri_segment != "" && $uri_segment != "all"){
    $option = parsing_param2($uri_segment);
    $awal = datefmysql($option['awal']);
    $akhir = datefmysql($option['akhir']);
    $donatur_tunggal = $option['donaturTunggal'];
    $id_donatur_tunggal = $option['idDonaturTunggal'];
}else{
    $awal = date("d/m/Y");
    $akhir = date("d/m/Y");
    $donatur_tunggal = "";
    $id_donatur_tunggal = "";
}
?>
<html>
    <head>
        <title>Cetak Laporan Keuangan Donatur Tunggal</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/style2.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/tabel.css" />
        <script type="text/javascript">
                function cetak() {
                        SCETAK.innerHTML = '';
                        window.print();
                        if (confirm('Apakah menu print ini akan ditutup?')) {
                                window.close();
                        }
                        SCETAK.innerHTML = '<br /><input onClick=\'cetak()\' type=\'submit\' name=\'Submit\' value=\'Cetak\' class=\'tombol\'>';
                }

        </script>
    </head>
    <body>
    <center>
        <h1>Laporan Keuangan Donatur Tunggal</h1>
        <h2>Periode <?php echo indo_tgl($awal)?> s.d <?php echo indo_tgl($akhir)?></h2>
        <?php
          if($donatur_tunggal != ''){
        ?>
        <h2>Nama Donatur Tunggal : <?php echo "$donatur_tunggal";?></h2>
        <?php
          }
        ?>
    </center>
    <div class="data-list">
        <table class="tabel" style="width: 100%">
            <tr>
                <th>No</th>
                <th>Tanggal</th>
                <th>Petugas</th>
                <th>Donatur Tunggal</th>
                <th>Keterangan</th>
                <th>Debet (Rp.)</th>
                <th>Kredit (Rp.)</th>
                <th>Saldo (Rp.)</th>
            </tr>
            <?php
            $offsets = isset ($offset)?$offset:0;
            $no = 1 + $offsets;
            foreach ($listKeuanganDonaturTunggal as $row){
            ?>
            <tr class="<?php echo ($no%2)?"even":"odd";?>">
                <td style="text-align: center"><?php echo $no++;?></td>
                <td><?php echo datefmysql($row['tanggal'])?></td>
                <td><?php echo $row['petugas']?></td>
                <td><?php echo $row['donatur_tunggal']?></td>
                <td><?php echo $row['keterangan']?></td>
                <td style="text-align: right">
                   <?php 
                      echo ($row['debet']!=0)?rupiah($row['debet']):"-";
                   ?>
                </td>
                <td style="text-align: right">
                   <?php 
                      echo ($row['kredit']!=0)?rupiah($row['kredit']):"-";
                   ?>
                </td>
                <td style="text-align: right"><?php echo rupiah($row['saldo'])?></td>
            </tr>
            <?php
            }
            ?>
        </table>
    </div>
    <center><span id="SCETAK"><input type="button" class="tombol" value="Cetak" onClick="cetak()"/></span></center>
    </body>
</html>        
